﻿
using Stardust.Common.Model;
using Stardust.ConfigCenterWeb.Code.Entities;
using Stardust.ConfigCenterWeb.Code.Repositories;
using Stardust.ConfigCenterWeb.Code.Repositories.Impl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Stardust.ConfigCenterWeb.Code.Services
{
    public class NodeEventService
    {
        public static NodeEventService Instance = new NodeEventService(new NodeEventRepository());

        INodeEventRepository _repository;
        public NodeEventService(INodeEventRepository repository)
        {
            _repository = repository;
        }

        public List<NodeEvent> GetNewList(long myMaxId, List<long> nodeIds)
        {
            return _repository.GetNewList(myMaxId, nodeIds);
        }

        public List<NodeEvent> GetNodesUpdates(List<GetNodesUpdateParams> list)
        {
            if (list == null || list.Count == 0)
            {
                return new List<NodeEvent>();
            }
            return _repository.GetNodesUpdates(list);
        }



        public long GetMaxId()
        {
            return _repository.GetMaxId();
        }

        public long Add(NodeEvent m)
        {
            return _repository.Add(m);
        }
    }
}
